'use strict'

class donetask {

    __mid() {
        return [
            {
                name: 'user-verify',
                path: ['post', 'delete', 'get']
            }
        ]
    }

    constructor() {
        this.param = '/'
    }
    //www.h5fd.xyz:2021/shop/donetask用户已完成任务表
    //创建资源
    async get(c) {
        try {
            var openid = c.box.user.openid;
            console.log(openid);
            let sqltext1 = `SELECT task_id `
                + `FROM user_task WHERE openid = '${openid}'`
            var r1 = await c.service.psql.query(sqltext1);
            console.log(r1.rows);
            if (r1.rowCount == 0) {
                return c.send('no data');
            }
            c.send(r1.rows);
            return
        }
        catch (err) {
            console.log(err);
            c.status(400).send('error');
        }
    }

}


module.exports = donetask